package robbie.WeatherApp;

import android.app.*;
import android.os.Bundle;
import android.widget.*;
import android.view.View;
import android.content.*;

public class AddActivity extends Activity{
	TextView t;
    EditText e;
    Button bAdd,bCancel;
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceBundle) 
    {
        super.onCreate(savedInstanceBundle);
        
        setContentView(R.layout.add);
        
        t = (TextView)findViewById(R.id.AddTextViewNumeOras);
        e = (EditText)findViewById(R.id.AddEditTextNumeOras);
        bAdd = (Button)findViewById(R.id.AddButtonAdd);
        bCancel = (Button)findViewById(R.id.AddButtonCancel);
        
        
        
        bAdd.setOnClickListener(new View.OnClickListener() {
			
			
			public void onClick(View v) 
			{
		    	Intent raspunde = new Intent();
		    	raspunde.setClass(AddActivity.this, WeatherAppActivity.class);
		    	raspunde.putExtra("nume_oras", e.getText().toString());
		    	setResult(1,raspunde);
		    	finish();
				
			}
		});
        
        bCancel.setOnClickListener(new View.OnClickListener() {
			
			
			public void onClick(View v) {
				setResult(0);
				finish();			
			}
		});
    
    }

}
